<template>
  <div id="air" @click="packUp();updated()">
      <router-link to="/airQuery" id="airQuery" class="queryNav">主页</router-link>
      <router-link to="/airLineQuery" id="airLineQuery" class="queryNav">++</router-link>
      <router-link to="/cityQuery" id="cityQuery" class="queryNav">++</router-link>
      <router-link to="/setting" id="setting" class="queryNav">++</router-link>
      <router-link to="/nationSearch" id="nationSearch" class="queryNav" @clcik="openNationSearch">++</router-link>
      <div class="pla-set-clear" id="set_clear" @click="clearAll">&#xe64e;</div>
      <router-view :close="shut"></router-view>
  </div>
</template>
<script>
    import * as vx from 'vuex'
    export default {
        name:'air',
        data () {
            return {
                shut:true
            }
        },
        methods:{
            ...vx.mapActions([
                'updated'
            ]),
            packUp:function () {
                this.shut=!this.shut;
            },
            clearAll:function () {
                window.location.href='#/';
                document.getElementById('air').style.zIndex=-10;
                if($('.pla-btn-national').css('display')!== 'none'){
                    openSearch();
                }
                var storage = window.sessionStorage;
                var atten = eval(storage.getItem('atten'));
                var flag = false;
                outpoint:for(var i=0;i<atten.length;i++){
                    var obj = atten[i];
                    var list = obj["data"];
                    for(var j=0;j<list.length;j++){
                        var fltObj = list[j];
                        if(fltObj.tag=true){
                            flag=true;
                            break outpoint;
                        }
                    }
                }
                //从右边菜单进入
                if(flag){
                    $('.labels-set').removeClass('labels-set');
                    $('.labels').each(function(){
                        var content=$(this).next().text();
                        if(content=='所有航班'){
                            $(this).addClass('labels-set');
                        }
                    });
                    //从仪表盘进入
                    if($('#focusFlights').is(':checked')){
                        $('#allFlights').attr('checked',true);
                    }
                }
            },
            openNationSearch: function () {
                $('#set_clear').hide();
            }
        },
        components:{

        }
    }
</script>

<style scoped>
    a{text-decoration:none}
</style>
